﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frame.Lib.Core.Base;

namespace Frame.Lib.Core.Log.Login
{
    public class LogLoginBO : CommonOperate<LogLoginInfo>
    {
        private LogLoginDAL _logLogin;



        public LogLoginBO()
        {
            _logLogin = new LogLoginDAL();
        }

        protected override BaseDAL DAL
        {
            get
            {
                return _logLogin;
            }
        }

        public void Delete()
        {
            _logLogin.Delete();
        }

        public void Delete(string startTime, string endTime)
        {
            _logLogin.Delete(startTime, endTime);

        }

        public void Write(int? userID, string loginName, string userName, string userIP, int loginResult)
        {
            LogLoginInfo info = new LogLoginInfo();

            if (userID != null)
            {
                info.UserID = userID.Value;
            }
            info.LoginName = loginName;
            info.UserName = userName;
            info.IP = userIP;

            info.Result = loginResult;

            info.InputTime = DateTime.Now;

            Save(info);
        }

       
    }
}
